Repository navigation
fix(studio): a preview frame served while its page loads keeps Studio's paused-frame decoder - #8613
Merged
Merged
Conversation
…'s paused-frame decoder servePausedVideoFrames closed its decoder host on the frame's next `load`. A shadow reload is served while its document is still `interactive`, so that `load` is the same document finishing: the host closed, aborted the decode already in flight without a reply, and the runtime's preview seek waited out its five-second cap. Every shadow reload in an embedding app then promoted about five seconds late. The host now closes only once the frame holds a different document (a frame Studio cannot read still closes on its next load), and a close answers every ask in flight with `failed` so the runtime falls back to its own frames at once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Edit accuracy: accurate 271 (base branch 271), smooth 44 of thoseThe gate passes. Quarantined, measured but not gated (0) |
Closing the host on the frame's next document is the fix. Answering in-flight asks on close only helps a frame Studio cannot read, which no reported bug reached; it goes, with its test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… said Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jrusso1020
approved these changes
Nov 23, 2026
jrusso1020
left a comment
Collaborator
There was a problem hiding this comment.
Approve at eb6dad2. The fix is small, targeted, and proven red-first.
What I checked
closeOnNextDocumentkeeps the paused-frame host through theloadof the document it was served for, and closes it once the frame holds any other document. A frame whose document Studio can't read still closes on its firstload, the same as before.closeis idempotent (closedguard), so a host that the.thenalready closed and thatloadcloses again is harmless.- Red first: I swapped in main's
pausedVideoProvider.tsand ran the newpausedVideoProvider.serve.test.ts. It fails (expected false to be trueon the same-document load). With the fix, the provider suites pass 3 files / 14 tests. - Non-blocking:
resolveFramePlaybackAdapterserves again oncepreviewEditingClientretires its client at that sameload. So for one document there are now two hosts, the first idle until the next document closes it. Before this change, the first host closed at thatload. Nothing leaks past the document's life, so this is fine as is.
Need ✅ (every shadow reload waited out the 5 s seek cap) · Size ✅ (one function, one test) · Reuse ✅ · Simpler ✅ · Structure ✅
Risk: low. It changes only when a served frame's host closes, and frames Studio can't read keep the old behavior.
— Rames (hf-review)
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A preview frame Studio serves paused video frames to while its page is still loading keeps that decoder host through the page's own
load.Why
servePausedVideoFramesclosed its host on the iframe's nextload. A shadow reload is served while its document is stillinteractive, once the runtime has announced itself. So thatloadis the same document finishing: the host closed and aborted the decode the frame had just asked for, and sent no reply. The runtime's preview seek then waited outSEEK_CAP_MS(5 s) before showing the frame. Every shadow reload in an app embedding Studio promoted about five seconds late.It shows in HyperFrames Desktop since its pin moved to 0.9.86 (the provider path landed in 0.9.81, #8466). A clip edit's preview showed the new file ~6.5–9.5 s after the write instead of ~2 s, so Desktop's 6 s "Background removed from the clip" notice faded before the clip appeared. Traced in a Desktop walk: serve at
readyState=interactive→ decode ask 5 ms later →load6 ms after that closes the host →data-hf-preview-seek-holdheld for exactly 5 s.A frame Studio cannot read (a sealed preview) still closes on its first
load, as before; if it is served before that load it can still wait out the cap. No reported bug reaches that case, so it is left alone here.No visible change
No
.tsx,.cssor.htmlchanges, and nothing a still image can show: the change is when a reloaded preview appears, not what it looks like. Measured in a HyperFrames Desktop walk instead: after an edit, the reloaded preview's frame swapped in 5.0 s after it painted on 0.9.86 (data-hf-preview-seek-holdheld for the fullSEEK_CAP_MS), and ~0.3 s after with this change.Related work
Refs #8466. Desktop carries this as a patch on
@hyperframes/studio@0.9.86until a release includes it.How
closeOnNextDocumentcloses the host only once the frame holds a document other than the one served. A frame whose document Studio cannot read (a sealed preview) still closes on its next load, as before.Test plan
pausedVideoProvider.serve.test.ts(a frame keeps being served through its own document's load and stops at the next document's). It fails without the fix and passes with it; the provider suites pass (14/14).clip-bar-remove-backgroundwalk passes.🤖 Generated with Claude Code